﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iLangl.Model;
using System.Xml;

namespace iLangl.Model
{
	public class SettingsForTPRequestContext : BaseContext
	{
		private SettingsFromTP settings = null;
		public override void SetContext(object context)
		{
			base.SetContext(context);

			if (context is SettingsFromTP)
			{
				settings = context as SettingsFromTP;
			}

			
		}
			
		public override object GetContext()
		{
			startDocument();


			writer.WriteStartElement("TPSettings");


			InitExtendedAttributes(writer, settings);

			LanguagesRequestContext languageContext = new LanguagesRequestContext();
			languageContext.SetContext(settings.Languages);
			languageContext.Write(writer);
		

			WorkareaRequestContext termContext = new WorkareaRequestContext();
			termContext.SetContext(settings.WorkAreas);
			termContext.Write(writer);

			ProductsRequestContext productContext = new ProductsRequestContext();
			productContext.SetContext(settings.Products);
			productContext.Write(writer);
			

			writer.WriteEndElement();
			return endDocument();
		}
	}
}
